#include <iostream>

using namespace std;

class Rect
{
public:
	Rect(int _w,int _h)
	{
		w=_w;
		h=_h;
	}
	Rect()
	{
		
	}
	Rect &operator+(int n)
	{
		//定义临时对象
		Rect *temp=new Rect;
		temp->w=this->w+n;
		temp->h=this->h+n;
		return *temp;
	}
	
	Rect &operator+(Rect &otherrect)
	{
		//定义临时对象
		Rect *temp=new Rect;
		temp->w=this->w+otherrect.w;
		temp->h=this->h+otherrect.h;
		return *temp;
	}
	void show()
	{
		cout<<"w "<<w<<"h "<<h<<endl;
	}
private:
	int w;
	int h;
};

int main()
{
	Rect rect1(10,5);
	Rect rect2=rect1+5; //翻译成rect1.operator+(5);
	rect2.show();
}